from  selenium import webdriver
import time

driver = webdriver.Chrome()
driver.get("https://www.baidu.com/")
#浏览器最大化
driver.maximize_window()
#用id来定位
# driver.find_element_by_id("kw").send_keys("雪中悍刀行")
# driver.find_element_by_id("su").click()
#name 定位
# driver.find_element_by_name("wd").send_keys("徐凤年")
# driver.find_element_by_id("su").click()
#class name
# driver.find_element_by_class_name("s_ipt nobg_s_fm_hover").send_keys("青鸟")
# driver.find_element_by_class_name("btn self-btn bg s_btn btn_h btnhover").click()
#link text  / partial link text
# driver.find_element_by_link_text("hao123").click()
# driver.find_element_by_partial_link_text("新").click()
# tag  name
# driver.find_element_by_tag_name("input").send_keys("徐凤年")
# driver.find_element_by_tag_name("input").click()
#xpath
# driver.find_element_by_xpath("//*[@id='kw']").send_keys("徐脂虎")
# driver.find_element_by_xpath("//*[@id='su']").click()
#Css selector
driver.find_element_by_css_selector("#kw").send_keys("徐渭熊")
driver.find_element_by_css_selector("#su").click()

time.sleep(6)
driver.quit()
